<?php if (!defined('BASEPATH')) exit('No direct script access allowed'); ?>

<?php 
	$ci = & get_instance();
	$mid = intval($_GET['mid']);
	$tid = intval($_GET['tid']);
	$MATCH = $ci->match_entity->init("id", $mid);
	$TEAM_HOME = clone_($ci->team_entity->init('id', $MATCH->getHome()));
	$TEAM_AWAY = clone_($ci->team_entity->init('id', $MATCH->getAway()));
	
	$score = array();
	if($MATCH->getPlaying() == 'yes'){
		$score = $ci->db->
			where( array( 'match_id'=>$MATCH->getFeedMatchId() , 'batting_team'=>$MATCH->getBattingTeam() ) )	//'type'=>$MATCH->getFeedType(),'key'=>$MATCH->getFeedKey(),
			->order_by('datetime','ASC')->get(TBL_SCORECARD)->result();
	}		
?>

<div class="blockitem" style="border-top:0 none;position:relative;">
	<div class="grid1">
		<span class="live"></span>
	</div>
	<div class="grid4" style="text-align:center;"><h4><?php echo $MATCH->getTitle();?></h4></div>
	<div class="clrboth"></div>
	
	<div class="grid2">
		<div class="team">
			<?php echo thumb($TEAM_HOME->getMyFlagTeam(),IMG_TEAMPIC_W,IMG_TEAMPIC_H);?>
			
			<div class="clrboth"></div>
			<span class="bold">
				<?php echo $MATCH->displayMatchInfo('home');?>
			</span>
			<div class="clrboth"></div>
		</div>
	</div>
	
	<div class="grid1" style="text-align:center;width:80px;"><?php echo vs_image(); ?></div>
	
	<div class="grid2" style="margin-left:-20px;">
		<div class="team">
			<?php echo thumb($TEAM_AWAY->getMyFlagTeam(),IMG_TEAMPIC_W,IMG_TEAMPIC_H);?>
			<div class="clrboth"></div>
			<span class="bold">
				<?php echo $MATCH->displayMatchInfo('away');?>
			</span>
		</div>
	</div>
	
	<div class="clrboth"></div>
	<div class="grid7">
		<div class="result-text" style="text-align:center;"><?php echo $MATCH->displayMatchInfo('closed');?></div>
	</div>
	
	
	
	<!--
		<a href="<?php //echo site_url("cricket/tournament/match/?tid=".$tid."&scrid=".mCrypt($tid));?>" style="color:#006699;" class="back_button" title="Back?">
			Back
		</a>
		-->
</div>